<template>
  <div>
    <!--  标题栏  -->
    <div class="backgroundWrapper">
      <div class="backIconWrapper">
        <img class="iconBack" src="../../../../src/assets/static/publicImg/back.png">
      </div>
    </div>
    <!--  标题栏  -->
    <div class="bodyWrapper">
      <!--  钱包相关  -->
      <div class="walletWrapper">
        <!--  pay  -->
        <div class="payWrapper">
          <img class="pay" src="../../../../src/assets/static/payQrcode/1.svg">
        </div>
        <!--  钱包余额  -->
        <div class="walletBalanceWrapper">
          <span class="walletBalance">钱包余额</span>
        </div>
        <!--  图标和数额  -->
        <div class="iconAmountWrapper">
          <div class="iconWrapper">
            <img class="icon" src="../../../../src/assets/static/payQrcode/4.svg">
          </div>
          <div class="amountWrapper">
            <span class="amount">2017.25</span>
          </div>
        </div>
      </div>
      <!--  二维码相关  -->
      <div class="qrCodeDiv">
        <!--  二维码  -->
        <div class="qrCodeWrapper">
          <img class="qrcode" src="../../../../src/assets/static/payQrcode/s-qrcode.png">
        </div>
        <!--  进度条  -->
        <div class="progressDiv">
          <img class="progressTwo" src="../../../../src/assets/static/payQrcode/3.svg">
          <img class="progressOne" src="../../../../src/assets/static/payQrcode/s-10.png">
        </div>
        <!--  刷新时间  -->
        <div class="refreshTime">
          <span>二维码刷新时间剩余24s</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  getAllArticleList, firstArticleList,
  allArticleList, nextReview, getArticleTopic,
  likeReview
} from '@/api/monico/home'

export default {
  name: 'Middle',
  components: {
  },
  data() {
    return {
      artical: [
        {}
      ],
    }
  },
  methods: {
    /**
     * 是否有图片
     * @param img
     * @returns {boolean}
     */
    handsPicture(img) {
      if (typeof (img) === Array) {
        return img.length !== 0
      } else {
        return false
      }
    },
    /**
     * 发布文章成功
     */
    createPostsSuccess() {
      this.firstArticleList()
    },
    // --------------------- axios -------------------------------
    /**
     * 获取所有文章列表
     */
    getAllArticleList() {
      getAllArticleList()
          .then(res => {
            this.artical = res.data.data
          })
    },
    /**
     * 关注人的文章列表
     */
    firstArticleList() {
      firstArticleList({}).then(res => {
        this.artical = res.data.data.list
      })
    },
    /**
     * 文章所用到的话题
     * @param pd
     */
    getArticleTopic(pd) {
      getArticleTopic(pd)
          .then(res => {
            console.log(res.data.data)
          })
    },
    /**
     *
     */
    nextReview() {
      const pd = {
        pid: 1,
        page: 1,
        pagesize: 10
      }
      nextReview(pd)
          .then(res => {
            this.artical = res.data.data.list
          })
    },
    /**
     * 点赞
     * @param object_type
     * @param like_type
     * @param id
     */
    likeReview(object_type, like_type, id) {
      const pd = {
        object_type: object_type,
        like_type: like_type,
        id: id
      }
      likeReview(pd)
          .then(res => {
            console.log(res.data.data)
          })
    },
    allArticleList() {
      const pd = {
        page: 1,
        limit: 10
      }
      allArticleList(pd)
          .then(res => {
            this.artical = res.data.data.list
          })
    },
  },
  mounted() {
  }
}
</script>

<style scoped>


/*-------------- message -----------------*/
.backgroundWrapper {
  padding-top: 40px;
  width: 750px;
  height: 330px;
  background-image: linear-gradient(#7AC91B, #5FBE00);
}
.qrcode {
  width: 518px;
  height: 518px;
}
.bodyWrapper {
  padding-top: 58px;
  margin-top: -238px;
  width: 750px;
  background-image: url("../../../../src/assets/static/payQrcode/5.svg");
}
.payWrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}
.pay {
  width: 91px;
  height: 52px;
}
.walletBalance {
  font-size: 22px;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
}
.walletBalanceWrapper {
  margin-top: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iconAmountWrapper {
  margin-top: 33px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iconWrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}
.qrCodeDiv {
  margin-top: 173px;
}
.qrCodeWrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}
.amount {
  font-size: 43px;
  font-family: Alibaba Puhuiti;
  font-weight: bold;
  color: #333333;
  margin-left: 13px;
}
.iconBack {
  width: 17px;
  height: 29px;
  margin-left: 30px;
}
.icon {
  width: 42px;
  height: 42px;
}
.progressDiv {
  width: 750px;
  display: flex;
  align-items: center;
  margin-top: 40px;
  margin-bottom: 34px;
}
.progressOne {
  margin-left: 90px;
  width: 570px;
}
.progressTwo {
  margin-left: 90px;
  position: absolute;
  width: 340px;
  justify-self: flex-end;
}
.refreshTime {
  font-size: 22px;
  font-family: "PingFang SC";
  font-weight: 500;
  color: #333333;
  margin-bottom: 60px;
  display: flex;
  justify-content: center;
}
</style>